@using BTCPayServer.Controllers
@model WalletSigningOptionsModel
@inject BTCPayNetworkProvider BTCPayNetworkProvider
@{
    var walletId = WalletId.Parse(Context.GetRouteValue("walletId").ToString());
	Model.ReturnUrl ??= Url.WalletTransactions(walletId);
    Layout = "_LayoutWizard";
    ViewData.SetTitle(StringLocalizer["Sign the transaction"]);
}

@section Navbar {
	<partial name="_BackAndReturn" model="Model" />
}

<header class="text-center">
    <h1 text-translate="true">Choose your signing method</h1>
    <p class="lead text-secondary mt-3" text-translate="true">You can sign the transaction using one of the following methods.</p>
</header>

<form method="post" asp-action="WalletSign" asp-route-walletId="@walletId">
    <partial name="SigningContext" for="SigningContext" />
    <input type="hidden" asp-for="ReturnUrl" />
    <input type="hidden" asp-for="BackUrl" />

    @if (BTCPayNetworkProvider.GetNetwork<BTCPayNetwork>(walletId.CryptoCode).VaultSupported)
    {
        <div class="list-group mt-4">
            <button type="submit" name="command" value="vault" class="list-group-item list-group-item-action only-for-js" id="SignWithVault">
                <div class="image">
                    <vc:icon symbol="wallet-hardware"/>
                </div>
                <div class="content d-flex flex-column flex-lg-row align-items-lg-center justify-content-lg-between me-2">
                    <div>
                        <h4 text-translate="true">Hardware wallet</h4>
                        <p class="mb-0 text-secondary" text-translate="true">Sign using our Vault application</p>
                    </div>
                    <small class="d-block text-primary mt-2 mt-lg-0" text-translate="true">Recommended</small>
                </div>
                <vc:icon symbol="caret-right"/>
            </button>
            <noscript>
                <div class="list-group-item disabled">
                    <div class="image">
                        <vc:icon symbol="wallet-hardware"/>
                    </div>
                    <div class="content d-flex flex-column flex-lg-row align-items-lg-center justify-content-lg-between me-2">
                        <div><h4 text-translate="true">Hardware wallet</h4>
                            <p class="mb-0" text-translate="true">Please enable JavaScript for this option to be available</p>
                        </div>
                    </div>
                </div>
            </noscript>
        </div>
    }

    <div class="list-group mt-4">
        <button type="submit" name="command" value="decode" class="list-group-item list-group-item-action" id="SignWithPSBT">
            <div class="image">
                <vc:icon symbol="wallet-file"/>
            </div>
            <div class="content">
                <h4>
                    <span text-translate="true">Partially Signed Bitcoin Transaction</span>
                    <small>
                        <a href="https://docs.btcpayserver.org/Wallet/#signing-with-a-wallet-supporting-psbt" target="_blank" rel="noreferrer noopener" title="@StringLocalizer["More information..."]">
                            <vc:icon symbol="info" />
                        </a>
                    </small>
                </h4>
                <p class="mb-0 text-secondary" text-translate="true">Offline signing, without connecting your wallet to the internet</p>
            </div>
            <vc:icon symbol="caret-right"/>
        </button>
    </div>

    <div class="list-group mt-4">
        <button type="submit" name="command" value="seed" class="list-group-item list-group-item-action" id="SignWithSeed">
            <div class="image">
                <vc:icon symbol="wallet-seed"/>
            </div>
            <div class="content d-flex flex-column flex-lg-row align-items-lg-center justify-content-lg-between me-2">
                <div>
                    <h4 text-translate="true">Private key or seed</h4>
                    <p class="mb-0 text-secondary" text-translate="true">Provide the 12 or 24 word recovery seed</p>
                </div>
                <small class="d-block text-danger mt-2 mt-lg-0" data-bs-toggle="tooltip" data-bs-placement="top" title="@StringLocalizer["You really should not type your seed into a device that is connected to the internet."]">
                    <span text-translate="true">Not recommended</span> <vc:icon symbol="info" />
                </small>
            </div>
            <vc:icon symbol="caret-right"/>
        </button>
    </div>
</form>
